#include <iostream>
void fnref(int (&refArray)[5]){
    for(auto &ra : refArray){
       std::cout<<ra<<std::endl;
    }
}
int main() {
    int nums[] = {1, 2, 3, 4, 5};
    int n = sizeof(nums) / sizeof(nums[0]);
 
    // 创建引用数组
    // 必须指定数组的大小，否则编译不通过，C++11环境
    int (&refArray)[5] = nums;
 
    // 使用引用数组
    for (int i = 0; i < n; ++i) {
        std::cout << "nums[" << i << "] = " << refArray[i] << std::endl;
    }
    for(auto &ra : refArray){
      ra += 10;
      //std::cout<<ra<<std::endl;
    }
 
    //调用引用参数的函数
    fnref(nums);
    return 0;
}
